{% extends "public/base.html" %}
{% load nm %}
{% load js %}
{% load none_if_epoch %}

{% block head_resources %}
  {{block.super}}
  {% jsinclude "tables" %}
{% endblock %}

{% block head %}
{{block.super}}
<script type="text/javascript">
$(function() {
    var perstable = $("#perstable");

    perstable.tablesorter({
        textExtraction: function(node) {
            val = node.getAttribute("val");
            if (val == null)
                val = node.textContent || node.innerText;
            return val;
        },
    });

{% if not status %}
    var tbody = perstable.find("tbody");
    var cached_rows = {
        "all": tbody.find("tr"),
        "new": tbody.find("tr.new"),
        "dm": tbody.find("tr.dm"),
        "dd": tbody.find("tr.dd"),
        "emeritus": tbody.find("tr.emeritus"),
        "removed": tbody.find("tr.removed"),
    };
    $("a.filter").click(function(el) {
        // Retrieve the filter name
        var filter = this.getAttribute("href").substr(1);

        if (filter == "all")
            cached_rows["all"].show();
        else
        {
            cached_rows["all"].hide();
            cached_rows[filter].show();
        }
        return false;
    });
{% endif %}
});
</script>
{% endblock %}

{% block breadcrumbs %}{{block.super}} / <a href="{% url 'people' %}">people</a>{% endblock %}

{% block content %}

{% if status %}
<h1>Debian New Member - Status {{status_sdesc}}</h2>
{% else %}
<h1>Debian New Member - People list</h2>
{% endif %}

<div id="intro">
{% if status %}
This is a list of all the <b>{{people|length}}</b> people known in the
database who have status "{{status_ldesc}}".
You can sort the table by clicking/shift+clicking on headers.
{% else %}
This is a list of all the <b>{{people|length}}</b> people known in the
database, grouped by status in the project. You can sort the table by
clicking/shift+clicking on headers, and filter it using the filters below.
{% endif %}

Note that the data import for things that were historically not handled by the
NM website is still incomplete.
</div>

{% if not status %}
<ul class="menubar">
    <li><a class="filter" href="#all">All</a></li>
    <li><a class="filter" href="#new">New</a></li>
    <li><a class="filter" href="#dm">DM</a></li>
    <li><a class="filter" href="#dd">DD</a></li>
    <li><a class="filter" href="#emeritus">Emeritus</a></li>
    <li><a class="filter" href="#removed">Removed</a></li>
</ul>
{% endif %}

<table id="perstable" class="tablesorter {{class}}">
<thead>
    <tr>
        {% if show_status %}
        <th>Status</th>
        {% endif %}
        <th>Since</th>
        <th>Account name</th>
        <th>Name</th>
    </tr>
</thead>
<tbody>
    {% for p in people %}
    <tr class="{{p.simple_status}}">
        {% if show_status %}
        <td val="{{p.status|seq_status}}"><a href="{% url 'people' status=p.status %}">{{p.status|desc_status}}</a></td>
        {% endif %}
        <td>{{p.status_changed|none_if_epoch|date:"Y-m-d"|default:"(unknown)"}}</td>
        <td><a href="{{ p.get_absolute_url }}">{{p.uid|default:"None chosen yet"}}</a></td>
        <td><a href="{{ p.get_absolute_url }}">{{p.fullname}}</a></td>
    </tr>
    {% endfor %}
</tbody>
</table>

{% endblock %}

